<?php
class home extends Activity {
    function indexTask(){
        $result=array();
        $cms=CmsView::init(null, null, array(
            "navFile"=>"admin/nav.json",
            "userInfoFile"=>"admin/userinfo.json",
            "controlFile"=>"",
        ));
        $url=WebRouter::init()->getPage("home","login");
        $cms->loginScene($url);
    }

    function loginTask($user, $pass){
        $userModule=AdminModule::init("admin");
        $message=$userModule->login($user, $pass);
        if($message->state==DataMessage::STATE_SUCCESS){
            header("Location:".WebRouter::init()->getPage("dash","index"));
        }else{
            $result["message"]=$message->title. ": ". $message->message;
            View::displayAsHtml($result, "plugin/state/tips.php");
        }
    }
}